
#ifndef _DRIVER_SIGNAL_CONVERT_H
#define _DRIVER_SIGNAL_CONVERT_H

#include  "HeaderFiles.h"


#define WALL_SENSOR_AD_MAX     4095
#if 0
#define WALL_SENSOR_AD_MIN     200
#else
#define WALL_SENSOR_AD_MIN     850
#endif


#define CLIFF_SENSOR_AD_MAX    4095
#define CLIFF_SENSOR_AD_MIN    850


#define VOLTAGE_CONVERT_SF     0.0088623f

#if 0
#define CURRENT_SAMPLE_SCALE   206.25f
#define CURRENT_CONVERT_SF     (CURRENT_SAMPLE_SCALE * 0.00024414f)  

#else

#define IS_SAMPE_OHM           0.2f
#define CURRENT_CONVERT_SF     (float32_t)((1.0F / IS_SAMPE_OHM) * (3.3f / 4096.0f))

#endif

#define NUM_CLIFF_LEFT         0
#define NUM_CLIFF_RIGHT        1
#define NUM_CLIFF_FRONT_LEFT   2
#define NUM_CLIFF_FRONT_RIGHT  3

#define NUM_INFRARED_LEFT        0
#define NUM_INFRARED_RIGHT       1

#if 1
#define NUM_INFRARED_BACK_LEFT   2
#define NUM_INFRARED_BACK_RIGHT  3
#else // caffer line order change -----------
#define NUM_INFRARED_BACK_LEFT   3
#define NUM_INFRARED_BACK_RIGHT  2
#endif

#define CLIFF_DIAG_THRE_MM     70
#define CLIFF_DIAG_SCHMIDT     10

#define BATTERY_CHARGE_FULL   16.3f

#define BATTERY_RATE_100      16.3f
#define BATTERY_RATE_0        11.5f

#define BATTERY_RATE_COFF_K   (100.0f / (BATTERY_RATE_100 - BATTERY_RATE_0))
#define BATTERY_RATE_COFF_B   (100.0f - (BATTERY_RATE_100 * BATTERY_RATE_COFF_K))


#define DCBUS_CURRENT_SF            (float32_t)((1.0f / 4096.0f) * 3.3f * 1.5f)
#define DCBUS_CURRENT_SENSOR_ZERO   (float32_t)(0.110f)
#define CHARGE_CURRENT_FULL_VALUE   (float32_t)(0.3f)
#define CHARGE_CURRENT_FULL_DIFF    (float32_t)(0.1f)
#define CHARGE_FULL_CNT_THRE        6000

#define CHARGE_FULL_TIME_HOURS      5
#define CHARGE_STATUS_CNT_THRE      (CHARGE_FULL_TIME_HOURS * 60 * 60 * 50)

extern void mcu_signal_convert(void);
extern void current_zero_calib(STR_USERHDL *hdl);
extern void obs_single_convert(void);
extern void wall_cliff_signal_convert(void);
#endif

